package com.cash.app.utils.extra.model

import com.google.gson.annotations.SerializedName
import com.cash.app.utils.extra.tools.GeneralUtils
import com.cash.app.utils.extra.tools.LanguageUtils
import com.cash.app.utils.extra.tools.NetWorkUtils
import com.cash.app.utils.extra.tools.OtherUtils

class GeneralData {

    @SerializedName("xm_and_id")
    var and_id: String? = null

    @SerializedName("xm_gaid")
    var gaid: String? = null

    @SerializedName("xm_network_operator_name")
    var network_operator_name: String? = null

    @SerializedName("xm_network_operator")
    var network_operator: String? = null

    @SerializedName("xm_network_type")
    var network_type: String? = null

    @SerializedName("xm_phone_type")
    var phone_type: String? = null

    @SerializedName("xm_mcc")
    var mcc: String? = null

    @SerializedName("xm_bluetooth_mac")
    var bluetooth_mac: String? = null

    @SerializedName("xm_mnc")
    var mnc: String? = null

    @SerializedName("xm_locale_iso_3_language")
    var locale_iso_3_language: String? = null

    @SerializedName("xm_locale_iso_3_country")
    var locale_iso_3_country: String? = null

    @SerializedName("xm_time_zone_id")
    var time_zone_id: String? = null

    @SerializedName("xm_locale_display_language")
    var locale_display_language: String? = null

    @SerializedName("xm_cid")
    var cid: String? = null

    @SerializedName("xm_dns")
    var dns: String? = null

    @SerializedName("xm_uuid")
    var uuid: String? = null

    @SerializedName("xm_slot_count")
    var slot_count: Int = 0

    @SerializedName("xm_meid")
    var meid: String? = null

    @SerializedName("xm_imei1")
    var imei1: String? = null

    @SerializedName("xm_imei2")
    var imei2: String? = null

    @SerializedName("xm_mac")
    var mac: String? = null

    @SerializedName("xm_language")
    var language: String? = null

    @SerializedName("xm_ui_mode_type")
    var ui_mode_type: String? = null

    @SerializedName("xm_security_patch")
    var security_patch: String? = null

    @SerializedName("xm_boot_time")
    var boot_time: Long = 0

    init {
        try {
            and_id = GeneralUtils.androidID
            gaid = GeneralUtils.gaid
            network_operator_name = GeneralUtils.networkOperatorName
            network_operator = GeneralUtils.networkOperator
            network_type = GeneralUtils.networkType
            phone_type = GeneralUtils.phoneType
            mcc = GeneralUtils.mcc
            mnc = GeneralUtils.mnc
            cid = GeneralUtils.cidNumbers
            dns = GeneralUtils.localDNS
            uuid = GeneralUtils.myUUID
            slot_count = OtherUtils.phoneSimCount
            meid = GeneralUtils.meid
            locale_iso_3_country = LanguageUtils.systemLanguage.getISO3Country()
            locale_iso_3_language = LanguageUtils.systemLanguage.getISO3Language()
            locale_display_language = LanguageUtils.systemLanguage.getDisplayLanguage()
            language = LanguageUtils.systemLanguage.getLanguage()
            imei1 = GeneralUtils.getIMEI(0)
            imei2 = GeneralUtils.getIMEI(1)
            ui_mode_type = GeneralUtils.uiModeType
            time_zone_id = LanguageUtils.currentTimeZone
            mac = NetWorkUtils.macAddress
            bluetooth_mac = NetWorkUtils.bluetoothMac
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                security_patch = android.os.Build.VERSION.SECURITY_PATCH
            }
            boot_time = android.os.SystemClock.uptimeMillis()
        } catch (e: java.util.MissingResourceException) {
            e.printStackTrace()
        }
    }

    override fun toString(): String {
        return "GeneralData(" +
                "and_id=$and_id, " +
                "gaid=$gaid, " +
                "network_operator_name=$network_operator_name, " +
                "network_operator=$network_operator, " +
                "network_type=$network_type, " +
                "phone_type=$phone_type, " +
                "mcc=$mcc, " +
                "bluetooth_mac=$bluetooth_mac, " +
                "mnc=$mnc, " +
                "locale_iso_3_language=$locale_iso_3_language, " +
                "locale_iso_3_country=$locale_iso_3_country, " +
                "time_zone_id=$time_zone_id, " +
                "locale_display_language=$locale_display_language, " +
                "cid=$cid, " +
                "dns=$dns, " +
                "uuid=$uuid, " +
                "slot_count=$slot_count, " +
                "meid=$meid, " +
                "imei1=$imei1, " +
                "imei2=$imei2, " +
                "mac=$mac, " +
                "language=$language, " +
                "ui_mode_type=$ui_mode_type, " +
                "security_patch=$security_patch, " +
                "boot_time=$boot_time" +
                ")"
    }
}
